(function(angular) {
	"use strict";
	angular.module("fs.waf").controller("cls.popup.loan.moreDataEditController", moreDataEditController);
	moreDataEditController.$inject = [ "$scope", "$uibModalInstance", "dialogsModule", "layoutConfig", "validatorConfig" ];
	function moreDataEditController($scope, $uibModalInstance, dialogsModule, layoutConfig, validatorConfig) {
		var ctrl = this;
		ctrl.dialogsModule = dialogsModule;
		ctrl.layoutConfig = layoutConfig;
		ctrl.validatorConfig = validatorConfig;
		ctrl.loan = {};
		ctrl.loan.dynamicParams = ctrl.dialogsModule.params || {};
		ctrl.formName = "loanForm";

		ctrl.init = function() {
		};

		ctrl.ok = function() {
			if ($scope.loanForm) {
				$scope.loanForm.$setSubmitted();
			}
			if ((!$scope.loanForm || $scope.loanForm.$valid) && (!dialogsModule.btnCallback || !dialogsModule.btnCallback["ok"] || dialogsModule.btnCallback["ok"](ctrl.loan) !== false)) {
				$uibModalInstance.close();
			}
		};

		ctrl.close = function() {
			if (!dialogsModule.btnCallback || !dialogsModule.btnCallback["close"] || dialogsModule.btnCallback["close"]() !== false) {
				$uibModalInstance.dismiss();
			}
		};

	}
})(angular);
